package com.dsj.gxrd.modules.controller.people;

import com.dsj.gxrd.modules.people.domain.dto.RdUserInfoDto;
import com.dsj.gxrd.modules.people.domain.entity.RdUserInfo;
import com.dsj.gxrd.modules.people.domain.query.RdUserInfoQuery;
import com.dsj.gxrd.modules.people.domain.vo.RdUserInfoVo;
import com.dsj.gxrd.modules.people.service.RdUserInfoService;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.api.RemoteAuthService;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.form.RegisterBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author songpin566
 * @date 2023/09/21
 **/
@Api(tags = "机构人员管理")
@RestController
@RequestMapping("/people/manage")
public class RdUserInfoController extends BaseController {

    @Autowired
    private RdUserInfoService userInfoService;

    @Autowired
    private RemoteAuthService authService;

    @RequiresPermissions("people:manage:list")
    @ApiOperation(value = "查询机构人员信息", response = RdUserInfoVo.class)
    @GetMapping("/list")
    public TableDataInfo list(RdUserInfoQuery userInfoQuery) {
        startPage();
        List<RdUserInfoVo> list = userInfoService.list(userInfoQuery);
        return getDataTable(list);
    }

    @RequiresPermissions("people:manage:add")
    @ApiOperation(value = "新增机构人员信息")
    @PostMapping()
    public AjaxResult add(@RequestBody RdUserInfoDto userInfoDto) {
        return userInfoService.add(userInfoDto);
    }

    @GetMapping("/test")
    public TableDataInfo test01() {
        List<RdUserInfoVo> list = userInfoService.test01();
        return getDataTable(list);
    }


}
